/* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   Module Name          : com.yaodian100.crm.workorder.service.WorkOrderService
   Module Description   :

   Date Created      : 2009/12/17
   Original Author   : andy.chuang
   Team              : yaodian100
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   MODIFICATION HISTORY
   ------------------------------------------------------------------------------
   Date Modified       Modified by       Comments
   ------------------------------------------------------------------------------
   ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
package com.yaodian100.crm.workorder.service;

import com.yaodian100.core.admin.entity.User;
import com.yaodian100.crm.workorder.entity.WorkOrder;

/**
 * @author andy.chuang
 * 
 */

public interface WorkOrderService {
	public WorkOrder createWorkOrder(String userName, String questionId, String questionShortDesc, boolean needApprove,
			User owner);

	public WorkOrder forwardOrder(String id, String comment, String responser, String workFlowNodeId, Integer priority);

	public void forwardOrder(String id, String comment, String responser, String workFlowNodeId, Integer priority,
			String class1, String class2, String commonQuestionType, String mustInquire, String answer,
			String showOnProductPage);

	public WorkOrder forwardOrder(WorkOrder woPre, String comment, String responser, String workFlowNodeId,
			Integer priority);

	public void backwardOrder(String id, String comment, String responser, String workFlowNodeId, Integer priority,
			String class1, String class2, String commonQuestionType, String mustInquire, String answer,
			String showOnProductPage);

	public void closeOrder(String questionId, String answer, String showOnProductPage, String workOrderId, String note,
			String finishType, String endPriority, String endClass1, String endClass2, String endClass3);

	public void closeOrder(String questionId, String answer, String showOnProductPage, String workOrderId, String note,
			String finishType, String endPriority, String endClass1, String endClass2, String endClass3, String compensation);

	public WorkOrder proxyOrder(String workOrderId, String responser);

	public WorkOrder transferOrder(String workOrderId, String responser);

	public String closeOrderForPayByProductArrive(String orderId, String responser);

	public String closeOrderForReturnProductApply(String returnId, String responser);

	public String closeOrderForPartialCancelOrder(String orderId, String responser);

	public String approveOrder(String id, String approveComment);

	public void rejectOrder(String id, String approveComment);

	public void confirmReturnProductApply(String id, String answer, String showOnProductPage, String workOrderId,
			String note, String returnId);

	public void cancelReturnProductApply(String id, String answer, String showOnProductPage, String workOrderId,
			String note, String returnId);

	// public String getWorkOrderIdByOrderId(String orderId);
	// public String getWorkOrderIdByOrderProductId(String orderProductId);

	/**
	 * 断货处理作业(n天内未处理的断货工单，要取消订单并结单)
	 * 
	 * @param day n天
	 */
	public void closeWorkOrderForOutOfStockOfDay(String day);

	/**
	 * 取消订单&结单
	 * 
	 * @return
	 */
	public void cancelOrderAndCloseWo(String id, String answer, String showOnProductPage, String workOrderId,
			String note, String finishType) throws Exception;

	/**
	 * 检查订单是否有產生ServiceOrder
	 * 
	 * @param orderId ex:'1103084324383'
	 * @return true or error msg
	 */
	public String chkServiceOrderByOrderId(String orderId);

	/**
	 * 更新订单状态为已发货
	 * 
	 * @param orderIds ex:'1103084324383', '1103114428789'
	 * @return true or error msg
	 */
	public String updOrderStatusTo30ByOrderId(String orderId);

	/**
	 * 检查是否已有SR单存在
	 * 
	 * @param serviceId
	 * @return true or error msg
	 */
	public String chkServiceOrderByServiceId(String serviceId);

	/**
	 * 更新Service单状态为已发货
	 * 
	 * @param serviceId
	 * @return true or error msg
	 */
	public String updServiceOrderStatusTo20ByServiceId(String serviceId);

	/*
	 * 若問題單未完成，則將原工單代結，並產生一新工單； 若問題單已完成，此method不允许成立
	 */
	public WorkOrder newOrder(Long workOrderId, String responser);

	public void batchAssign(String[] workOrderIds, String taskGroupId, String[] userIds, String[] assignCounts);

	public WorkOrder get(Long workOrderId, String username);

	public WorkOrder forwardOrderForRemote(String id, String comment, String creater, String responseGroup,
			String workFlowNodeId, Integer priority);

	public WorkOrder forwardOrder(WorkOrder woPre, String comment, String creater, String responseGroup,
			String workFlowNodeId, Integer priority);

	/**
	 * 商品评论 結单
	 * 
	 * @param id
	 * @param answer
	 * @param showOnProductPage
	 * @param workOrderId
	 * @param note
	 * @param finishType
	 * @param endPriority
	 * @param endClass1
	 * @param endClass2
	 * @param endClass3
	 * @param compensation
	 * @param type
	 */
	public void closeProductCommentOrder(String id, String answer, String showOnProductPage, String workOrderId,
			String note, String finishType, String endPriority, String endClass1, String endClass2, String endClass3,
			String compensation, String type) throws NumberFormatException, Exception;

	/**
	 * 商品评论 結单
	 */
	public void closeProductCommentOrderFromCM(String commentId, String reason);
}
